<template>
  <div class="info">
    <el-form :model='searchInfo' inline></el-form>
    <el-table :data=performerList style="width: 100%" border >
      <el-table-column label="编号" prop="actorId"  align="center" />
      <el-table-column label="姓名" prop="actorName"  align="center" />
      <el-table-column label="性别" prop="sex"  align="center" />
      <el-table-column label="生日" prop="birthday"  align="center" />
      <el-table-column label="介绍" prop="profile"  align="center" />
      <el-table-column label="信息状态" prop="status" align="center">
        <template slot-scope="scope">
          <el-button type="danger" v-if="scope.row.status===0">禁用</el-button>
          <el-button type="success" v-if="scope.row.status===1">可用</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination layout="total,prev,pager,next,sizes,jumper"
                   :total="pageInfo.totalCount"
                   :page-size="pageInfo.pageSize"
                   :current-page="pageInfo.currPage"
                   :page-sizes="[5,10,20,30,50,100]"
                   @size-change="sizeChange"
                   @current-change="currentChange"
    />
  </div>
</template>

<script>

export default {
  name: 'Performer',
  data () {
    return {
      performerList: [],
      searchInfo: {
        page: 1,
        limit: 10
      },
      pageInfo: {}
    }
  },
  methods: {
    init (vipId) {
      this.searchInfo = { ...this.searchInfo }
      this.$http.get(`/sys/vip/actor/${vipId}`, this.searchInfo).then(({ data }) => {
        if (data.code === 200) {
          this.performerList = data.data.list
          this.pageInfo = data.data
        }
      })
    },
    sizeChange (limit) {
      this.searchInfo.limit = limit
      this.init()
    },
    currentChange (page) {
      this.searchInfo.page = page
      this.init()
    }
  },
  created () {
    this.$nextTick(() => {
      this.init()
    })
  }
}
</script>

<style scoped>

</style>
